package com.myself.hello.web.dao;

import com.myself.hello.web.dataobject.WangruqingAccountingrecord;
import java.util.List;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;
@Mapper
public interface WangruqingAccountingrecordMapper {
    @Delete({
        "delete from wangruqing_accountingrecord",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into wangruqing_accountingrecord (id, gmt_created, ",
        "gmt_modified, create_time, ",
        "amount, type, category, ",
        "desc)",
        "values (#{id,jdbcType=BIGINT}, now()}, ",
        "now(), #{createTime,jdbcType=VARCHAR}, ",
        "#{amount,jdbcType=DOUBLE}, #{type,jdbcType=VARCHAR}, #{category,jdbcType=VARCHAR}, ",
        "#{desc,jdbcType=VARCHAR})"
    })
    int insert(WangruqingAccountingrecord record);

    @Select({
        "select",
        "id, gmt_created, gmt_modified, create_time, amount, type, category, desc",
        "from wangruqing_accountingrecord",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DOUBLE),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="category", property="category", jdbcType=JdbcType.VARCHAR),
        @Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR)
    })
    WangruqingAccountingrecord selectByPrimaryKey(Long id);

    @Select({
        "select",
        "id, gmt_created, gmt_modified, create_time, amount, type, category, desc",
        "from wangruqing_accountingrecord"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="gmt_created", property="gmtCreated", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="gmt_modified", property="gmtModified", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.VARCHAR),
        @Result(column="amount", property="amount", jdbcType=JdbcType.DOUBLE),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="category", property="category", jdbcType=JdbcType.VARCHAR),
        @Result(column="desc", property="desc", jdbcType=JdbcType.VARCHAR)
    })
    List<WangruqingAccountingrecord> selectAll();

    @Update({
        "update wangruqing_accountingrecord",
        "set ",
          "gmt_modified = now(),",
          "create_time = #{createTime,jdbcType=VARCHAR},",
          "amount = #{amount,jdbcType=DOUBLE},",
          "type = #{type,jdbcType=VARCHAR},",
          "category = #{category,jdbcType=VARCHAR},",
          "desc = #{desc,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WangruqingAccountingrecord record);
}